package com.intellij.licensecommon.data;

import java.util.Date;

public abstract class AbstractSubscriptionLicenseData implements LicenseData {
    private final String key;
    private final String username;
    private boolean accepted;
    private boolean fromUser;

    protected AbstractSubscriptionLicenseData(String key, String username) {
        this.key = key;
        this.username = username;
        this.accepted = true;
        this.fromUser = false;
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean k() {
        return false;
    }

    @Override
    public Date getGenerationDate() {
        return null;
    }

    @Override
    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof AbstractSubscriptionLicenseData)) {
            return false;
        }
        AbstractSubscriptionLicenseData that = (AbstractSubscriptionLicenseData) other;
        if (this.key != null ? !this.key.equals(that.key) : that.key != null) {
            return false;
        }
        if (this.username != null ? !this.username.equals(that.username) : that.username != null) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int i = this.key != null ? this.key.hashCode() : 0;
        i = 29 * i + (this.username != null ? this.username.hashCode() : 0);
        return i;
    }

    @Override
    public boolean isAccepted() {
        return this.accepted;
    }

    @Override
    public void setAccepted(boolean accepted) {
        this.accepted = accepted;
    }

    @Override
    public boolean isFromUser() {
        return this.fromUser;
    }

    @Override
    public void setFromUser(boolean fromUser) {
        this.fromUser = fromUser;
    }
}
